﻿@using Newtouch.Infrastructure;
@{
    ViewBag.Title = "医保病人信息";
    Layout = "~/Views/Shared/_Index.cshtml";
}
@{
    //是否和新农合交易
    var openXnhSett = SysConfigReader.Bool("Inpatient_Sett_OpenXnhSett");
    //是否和医保交易
    var openYbSett = SysConfigReader.Bool("Outpatient_ChargeFee_OpenYbSett");
    //医保患者必须一次结掉
    bool? ybSettOnce = (openYbSett ?? false) && (SysConfigReader.Bool("Outpatient_ChargeFee_yb_SettOnce") ?? false);
    var opr = Newtouch.Common.Operator.OperatorProvider.GetCurrent();
    //医保所属地
    var medicalInsurance = SysConfigReader.String("Outpatient_MedicalInsurance");
}
<style type="text/css">
    .form .formTitleTh {
        position: relative;
        left: 0px;
        text-align: right;
        white-space: nowrap;
        font-weight: normal;
        width: 120px;
        padding-right: 0px;
    }

    .form .formTitleAccount {
        position: relative;
        left: 0px;
        text-align: right;
        white-space: nowrap;
        font-weight: normal;
        width: 200px;
        padding-right: 0px;
    }

    .form .formValueYb {
        position: relative;
        width: auto;
        padding: 5px;
        text-align: left;
    }
</style>
<div class="panel panel-default" style="margin-bottom: 4px;">
    <div class="panel-heading navb-bg">
        筛选条件
    </div>

    <div style="padding-right:20px;">
        <table class="form">
            <tr>
                <th class="formTitle">类型：</th>
                <td class="formValue" style="width:150px">
                    @Html.DropDownList("sel_rptype", EnumYbQuery.rydyxs.ToDescSelectList(), new { @class = "form-control form-an" })
                </td>
                <th class="formTitle">开始日期：</th>
                <td class="formValue">
                    <input id="kssj" type="text" class="form-control input-wdatepicker form-an"
                           onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd'})" value="@(DateTime.Now.ToString("yyyy-MM-01"))" />
                </td>
                <th class="formTitle">结束日期：</th>
                <td class="formValue">
                    <input id="jssj" type="text" class="form-control input-wdatepicker form-an"
                           onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd'})" value="@(DateTime.Now.ToString("yyyy-MM-dd"))" />
                </td>
                <td class="formTitle" style="width:50px">
                    <input type="button" class="btn btn-default btn-md btn-default-color" id="btkhsr" value="查询" onclick="GetYbInfo()" />
                </td>
                <td class="formValue">
                    @if (openYbSett == true || openXnhSett == true)
                    {
                    <div id="readCard" style="color:orangered;display:initial;">
                        <input type="button" id="btkhsr" value="证件号输入" class="form-control" style="border-color:#00a0e9; margin-left: 0px;margin-top: 2px; height: 23px;width:44px;float: left;vertical-align:central;" onclick="GetPatSbkh()" />
                        <i class="fa fa-id-card" style="font-size: 27px; float: left;vertical-align:central;" title="读卡"></i>
                        <select id="readCardCardType" class="form-control" style="margin-left: 0px;margin-top: 2px; height: 22px;width:36px;float: left;vertical-align:central;">
                            @if (openYbSett == true)
                            {
                                <option value="03">社</option>
                            }
                            <option value="01">社(电)</option>
                            <option value="02">身</option>
                        </select>
                    </div>
                    }
                </td>
            </tr>
            <tr>
                <th class="formTitle">医疗类别：</th>
                <td class="formValue" style="width: 170px">
                    @Html.DropDownList("sel_yllb", Enumyllb.ptmz.ToDescSelectList(), new { @class = "form-control form-an" })

                </td>
                <th class="formTitle">结算ID：</th>
                <td class="formValue">
                    <input type="text" id="settId" name="settId" class="form-control" style="width:150px" />
                </td>
                <th class="formTitle">就诊ID：</th>
                <td class="formValue">
                    <input type="text" id="jzId" name="jzId" class="form-control" style="width:150px" />
                </td>
            </tr>
        </table>

    </div>
</div>
<div class="panel panel-default" style="margin-bottom: 4px;">
    <div class="panel-heading navb-bg">
        基本信息
    </div>
    <div style="padding-right:0px; text-align:center">
        <table class="form">
            <tr>
                <th class="formTitleTh">人员编号：</th>
                <td class="formValueYb" style="width: 120px;">
                    <label id="rybh"></label>
                </td>
                <th class="formTitleTh">证件号码：</th>
                <td class="formValueYb" style="width: 120px;">
                    <label id="zjhm"></label>
                </td>
                <td class="formTitleTh">姓名：</td>
                <td class="formValueYb">
                    <label id="xm"></label>
                </td>
                <td class="formTitleTh">性别：</td>
                <td class="formValueYb">
                    <label id="xb"></label>
                </td>
                @*<th class="formTitleTh">民族：</th>
                <td class="formValueYb">
                    <label id="mz"></label>
                </td>*@

            </tr>
            <tr>
                <th class="formTitleTh">出生日期：</th>
                <td class="formValueYb">
                    <label id="csny"></label>
                </td>
                <th class="formTitleTh">年龄：</th>
                <td class="formValueYb">
                    <label id="nl"></label>
                </td>

            </tr>

        </table>
    </div>
</div>
<div class="panel panel-default" style="margin-bottom: 4px;">
    <div class="panel-heading navb-bg">
        信息列表
    </div>
    <div style="padding-right:20px;">
        <form id="formPat2">
            <div class="gridPanel" style="margin-top:10px;border-radius:5px;">
                @*<table id="gridList"></table>*@
            </div>
        </form>
    </div>
</div>

<script type="text/javascript">
    var openYbSett = '@openYbSett' === 'True'; //开关配置：医保患者是否使用医保交易流程
    var ybSettOnce = '@ybSettOnce' === 'True'; //开关配置：医保患者是否一次结
    var medicalInsurance = '@medicalInsurance';//医保所属地配置:区分医院所属医保区域
    var cqPatInfo = {};//患者读卡信息
    //读卡
    function readCard() {
        var cardInfo;
        var yibaoCardInfo;
        var cqcardInfo;
        var cqyibaoCardInfo;
        GetReadCardInfo(null,false);
    }
    $('#jzId').newtouchBatchFloatingSelector({
        width: 500,
        height: 200,
        caption: "选择就诊",
        clickautotrigger: true,
        url: "/PatientManage/HospiterRes/Getjzjsxx",
        ajaxparameters: function ($thisinput) {
            var jzid = $thisinput.val().trim();
            return "keyword=" + jzid + "&grbh=" + cqPatInfo.grbh + "&type=1";
        },
        itemdbclickhandler: function ($thistr, $thisinput) {
            $("#jzId").val($thistr.attr("data-jzid"));
        },
        colModel: [
            { label: '门诊住院号', name: 'zymzh', width: 120, align: 'left' },
            { label: '类型', name: 'type', width: 50, align: 'center' },
            { label: '就诊ID', name: 'jzid', width: 50, align: 'center' },
            { label: '就诊时间', name: 'jzsj', width: 200, align: 'center' }
        ]
    });
    $('#settId').newtouchBatchFloatingSelector({
        width: 500,
        height: 200,
        caption: "选择就诊",
        clickautotrigger: true,
        url: "/PatientManage/HospiterRes/Getjzjsxx",
        ajaxparameters: function ($thisinput) {
            var jsid = $thisinput.val().trim();
            return "keyword=" + jsid + "&grbh=" + cqPatInfo.grbh + "&type=2";
        },
        itemdbclickhandler: function ($thistr, $thisinput) {
            $("#settId").val($thistr.attr("data-jylsh"));
        },
        colModel: [
            { label: '门诊住院号', name: 'zymzh', width: 120, align: 'left' },
            { label: '类型', name: 'type', width: 50, align: 'center' },
            { label: '结算ID', name: 'jylsh', width: 50, align: 'center' },
            { label: '就诊ID', name: 'jzid', width: 50, align: 'center' },
            { label: '结算时间', name: 'jssj', width: 200, align: 'center' }
        ]
    });
    function GetYbInfo()
    {
        var type = $('#sel_rptype').val();
        if (type=="1")
        {
            var dyxsData = { begntime: $('#kssj').val(),psn_no: cqPatInfo.grbh, insutype:cqPatInfo.xzlx,med_type: $('#sel_yllb').val(), operatorId: '@(opr.rygh)', operatorName: '@(opr.UserName)', insuplc_admdvs: cqPatInfo.xzqh };
          
            $.ajax({
                type: "POST",
                url: "http://127.0.0.1:33333/api/YiBao/GetPersonnelTreatment_2001",
                dataType: "json",
                data: dyxsData,
                async: false,
                success: function (data) {
                    var TbMzReg = eval('(' + data + ')');
                    if (TbMzReg) {
                        if (TbMzReg.infcode == "0" && !!TbMzReg.output.trtinfo) {
                            gridListData(TbMzReg.output.trtinfo,type);
                        }
                        else {
                            gridListData("", type);
                            $.modalAlert(TbMzReg.err_msg, 'error');
                        }
                    }
                },
                error: function () {
                    $.modalAlert("服务不可访问", 'warning');
                }
            });

        }
        else if(type=="2")
        {
            var rcData = { begntime: $('#kssj').val(), endtime: $('#jssj').val(), med_type:'21', mdtrt_id: $('#jzId').val(), psn_no: cqPatInfo.grbh, operatorId: '@(opr.rygh)', operatorName: '@(opr.UserName)', insuplc_admdvs: cqPatInfo.xzqh };
            $.ajax({
                type: "POST",
                url: "http://127.0.0.1:33333/api/YiBao/GetRegistration_5201",
                dataType: "json",
                data: rcData,
                async: false,
                success: function (data) {
                    var refReg = eval('(' + data + ')');
                    if (refReg) {
                        if (refReg.infcode == "0" && !!refReg.output.mdtrtinfo) {
                            gridListData(refReg.output.mdtrtinfo, type);
                        }
                        else {
                            gridListData("", type);
                            $.modalAlert(refReg.err_msg, 'error');
                        }
                    }
                },
                error: function () {
                    $.modalAlert("服务不可访问", 'warning');
                }
            });
        }
        else if (type == "3") {
            var rcData = { setl_id: $('#settId').val(), mdtrt_id: $('#jzId').val(), psn_no: cqPatInfo.grbh, operatorId: '@(opr.rygh)', operatorName: '@(opr.UserName)', insuplc_admdvs: cqPatInfo.xzqh };
            $.ajax({
                type: "POST",
                url: "http://127.0.0.1:33333/api/YiBao/GetDiagnosis_5202",
                dataType: "json",
                data: rcData,
                async: false,
                success: function (data) {
                    var refReg = eval('(' + data + ')');
                    if (refReg) {
                        if (refReg.infcode == "0" && !!refReg.output.diseinfo) {
                            gridListData(refReg.output.diseinfo, type);
                        }
                        else {
                            gridListData("", type);
                            $.modalAlert(refReg.err_msg, 'error');
                        }
                    }
                },
                error: function () {
                    $.modalAlert("服务不可访问", 'warning');
                }
            });
        }
        else if (type == "4") {
            var rcData = { setl_id: $('#settId').val(), mdtrt_id: $('#jzId').val(), psn_no: cqPatInfo.grbh, operatorId: '@(opr.rygh)', operatorName: '@(opr.UserName)', insuplc_admdvs: cqPatInfo.xzqh };
            $.ajax({
                type: "POST",
                url: "http://127.0.0.1:33333/api/YiBao/GetHospitaSettlement_5203",
                dataType: "json",
                data: rcData,
                async: false,
                success: function (data) {
                    var refReg = eval('(' + data + ')');
                    if (refReg) {
                        if (refReg.infcode == "0" && !!refReg.output.setlinfo) {
                            gridListData(refReg.output.setlinfo, type);
                        }
                        else {
                            gridListData("", type);
                            $.modalAlert(refReg.err_msg, 'error');
                        }
                    }
                },
                error: function () {
                    $.modalAlert("服务不可访问", 'warning');
                }
            });
        }
        else if (type == "5") {
            var rcData = { setl_id: $('#settId').val(), mdtrt_id: $('#jzId').val(), psn_no: cqPatInfo.grbh, operatorId: '@(opr.rygh)', operatorName: '@(opr.UserName)', insuplc_admdvs: cqPatInfo.xzqh };
            $.ajax({
                type: "POST",
                url: "http://127.0.0.1:33333/api/YiBao/GetHospitaSettlement_5204",
                dataType: "json",
                data: rcData,
                async: false,
                success: function (data) {
                    var refReg = eval('(' + data + ')');
                    if (refReg) {
                        if (refReg.infcode == "0" && !!refReg.output) {
                            gridListData(refReg.output, type);
                        }
                        else {
                            gridListData("", type);
                            $.modalAlert(refReg.err_msg, 'error');
                        }
                    }
                },
                error: function () {
                    $.modalAlert("服务不可访问", 'warning');
                }
            });
        }
        else if (type == "6") {
            var rcData = { begntime: $('#kssj').val(), endtime: $('#jssj').val(), psn_no: cqPatInfo.grbh, operatorId: '@(opr.rygh)', operatorName: '@(opr.UserName)', insuplc_admdvs: cqPatInfo.xzqh };
            $.ajax({
                type: "POST",
                url: "http://127.0.0.1:33333/api/YiBao/GetSpecialDisease_5205",
                dataType: "json",
                data: rcData,
                async: false,
                success: function (data) {
                    var refReg = eval('(' + data + ')');
                    if (refReg) {
                        if (refReg.infcode == "0" && !!refReg.output.feedetail) {
                            gridListData(refReg.output.feedetail, type);
                        }
                        else {
                            gridListData("", type);
                            $.modalAlert(refReg.err_msg, 'error');
                        }
                    }
                },
                error: function () {
                    $.modalAlert("服务不可访问", 'warning');
                }
            });
        }
        else if (type == "7") {
            var rcData = { psn_no: cqPatInfo.grbh, operatorId: '@(opr.rygh)', operatorName: '@(opr.UserName)', insuplc_admdvs: cqPatInfo.xzqh };
            $.ajax({
                type: "POST",
                url: "http://127.0.0.1:33333/api/YiBao/GetPeopleTotalInfo_5206",
                dataType: "json",
                data: rcData,
                async: false,
                success: function (data) {
                    var refReg = eval('(' + data + ')');
                    if (refReg) {
                        if (refReg.infcode == "0" && !!refReg.output.cuminfo) {
                            gridListData(refReg.output.cuminfo, type);
                        }
                        else {
                            gridListData("", type);
                            $.modalAlert(refReg.err_msg, 'error');
                        }
                    }
                },
                error: function () {
                    $.modalAlert("服务不可访问", 'warning');
                }
            });
        }
        else if (type == "8") {
            var tsbData = { psn_no: cqPatInfo.grbh, operatorId: '@(opr.rygh)', operatorName: '@(opr.UserName)', insuplc_admdvs: cqPatInfo.xzqh };
            $.ajax({
                type: "POST",
                url: "http://127.0.0.1:33333/api/YiBao/SlowDisease_5301",
                dataType: "json",
                data: tsbData,
                async: false,
                success: function (data) {
                    var TbMzReg = eval('(' + data + ')');
                    if (TbMzReg) {
                        if (TbMzReg.infcode == "0" && !!TbMzReg.output.feedetail) {
                            gridListData(TbMzReg.output.feedetail, type);
                        }
                        else {
                            gridListData("", type);
                            $.modalAlert(TbMzReg.err_msg, 'error');
                        }
                    }
                },
                error: function () {
                    $.modalAlert("服务不可访问", 'warning');
                }
            });

        }
        else if (type == "9") {
            var rcData = { biz_appy_type:"01", psn_no: cqPatInfo.grbh, operatorId: '@(opr.rygh)', operatorName: '@(opr.UserName)', insuplc_admdvs: cqPatInfo.xzqh };
            $.ajax({
                type: "POST",
                url: "http://127.0.0.1:33333/api/YiBao/GetPersonnel_5302",
                dataType: "json",
                data: rcData,
                async: false,
                success: function (data) {
                    var refReg = eval('(' + data + ')');
                    if (refReg) {
                        if (refReg.infcode == "0" && !!refReg.output.psnfixmedin) {
                            gridListData(refReg.output.psnfixmedin, type);
                        }
                        else {
                            gridListData("", type);
                            $.modalAlert(refReg.err_msg, 'error');
                        }
                    }
                },
                error: function () {
                    $.modalAlert("服务不可访问", 'warning');
                }
            });
        }
        else if (type == "10") {
            var rcData = { begntime: $('#kssj').val(), endtime: $('#jssj').val(), psn_no: cqPatInfo.grbh, operatorId: '@(opr.rygh)', operatorName: '@(opr.UserName)', insuplc_admdvs: cqPatInfo.xzqh };
            $.ajax({
                type: "POST",
                url: "http://127.0.0.1:33333/api/YiBao/GetInHospital_5303",
                dataType: "json",
                data: rcData,
                async: false,
                success: function (data) {
                    var refReg = eval('(' + data + ')');
                    if (refReg) {
                        if (refReg.infcode == "0" && !!refReg.output.data) {
                            gridListData(refReg.output.data, type);
                        }
                        else {
                            gridListData("", type);
                            $.modalAlert(refReg.err_msg, 'error');
                        }
                    }
                },
                error: function () {
                    $.modalAlert("服务不可访问", 'warning');
                }
            });
        }
        else if (type == "11") {
            var rcData = { begntime: $('#kssj').val(), psn_no: cqPatInfo.grbh, operatorId: '@(opr.rygh)', operatorName: '@(opr.UserName)', insuplc_admdvs: cqPatInfo.xzqh };
            $.ajax({
                type: "POST",
                url: "http://127.0.0.1:33333/api/YiBao/GetTurnHospital_5304",
                dataType: "json",
                data: rcData,
                async: false,
                success: function (data) {
                    var refReg = eval('(' + data + ')');
                    if (refReg) {
                        if (refReg.infcode == "0" && !!refReg.output.refmedin) {
                            gridListData(refReg.output.refmedin, type);
                        }
                        else {
                            gridListData("", type);
                            $.modalAlert(refReg.err_msg, 'error');
                        }
                    }
                },
                error: function () {
                    $.modalAlert("服务不可访问", 'warning');
                }
            });
        }

    }

    //待遇享受列表
    function gridListData(mydata, type) {
        var colModel;

        var captionCon = "";
        switch (type) {
            case '1':
                captionCon = "待遇享受列表";
                colModel = [
        { label: '人员编号', name: 'psn_no', width: 105,align: 'center' },
        {
            label: '待遇检查类型', name: "trt_chk_type", width: 105, align: 'center', formatter: function (val) {
                return $.enum.getDescByValue("Enumdyjclx", val);
            }
        },
         {
             label: '基金支付类型编码', name: 'fund_pay_type', width: 105, align: 'center'
         },
        { label: '基金支付类型', name: 'fund_pay_type', width: 105, align: 'center', formatter: function (val) {
            return $.enum.getDescByValue("Enumjjzflx", val);
        }
        },
    
        {
            label: '基金款项待遇享受标志', name: 'trt_enjymnt_flag', width: 105, align: 'center', formatter: function (val) {
                return $.enum.getDescByValue("Enumdyxsbz", val);
            }
        },
        { label: '开始日期', name: 'begndate', width: 105, align: 'center', formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },
        { label: '结束日期', name: 'enddate', width: 125, align: 'center', formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },
        { label: '待遇检查结果', name: 'trt_chk_rslt', width: 105, align: 'center' },
                ];
                break;
            case "2":
                captionCon = "就诊信息";
                colModel = [
       { label: '就诊ID', name: 'mdtrt_id', width: 55,  align: 'center' },
       { label: '开始时间', name: 'begntime', width: 105, formatter: "number", align: 'center', formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },
       { label: '结束时间', name: 'endtime', width: 105, align: 'center', formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },
       { label: '住院/门诊号', name: 'ipt_otp_no', width: 105, align: 'center' },
       { label: '主治医生编码', name: 'atddr_no', width: 105, align: 'center' },
       { label: '主诊医师姓名', name: 'chfpdr_name', width: 105, align: 'center'},
       { label: '科室编码', name: 'adm_dept_codg', width: 85, align: 'center' },
       { label: '科室名称', name: 'adm_dept_name', width: 85, align: 'center' },
       { label: '病种编码', name: 'dise_codg', width: 85, align: 'center' },
        { label: '病种名称', name: 'dise_name', width: 85, align: 'center' },
                ];
                break;
            case "3":
                captionCon = "诊断信息";
                colModel = [
      { label: '就诊ID', name: 'mdtrt_id', width: 55, align: 'center' },
      {
          label: '诊断类别', name: 'diag_type', width: 105, formatter: function (val) {
              return $.enum.getDescByValue("Enumzdlx", val);
          }
      },
      {
          label: '主诊断标志', name: 'maindiag_flag', width: 105, align: 'center', formatter: function (val) {
              return $.enum.getDescByValue("Enumdyxsbz", val);
          }
      },
      { label: '诊断代码', name: 'diag_code', width: 60, align: 'center' },
      { label: '诊断名称', name: 'diag_name', width: 105, align: 'center' },
      { label: '诊断科室', name: 'diag_dept', width: 105, align: 'center' },
      { label: '诊断医生编码', name: 'dise_dor_no', width: 85, align: 'center' },
      { label: '诊断医生姓名', name: 'dise_dor_name', width: 105, align: 'center' },
      { label: '诊断时间', name: 'diag_time', width: 105, align: 'center',formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },
                ];
                break;
            case "4":
                captionCon = "结算信息";
                colModel = [
     { label: '结算ID', name: 'setl_id', width: 85, align: 'center' },
     { label: '就诊 ID', name: 'mdtrt_id', width: 85 },
     { label: '开始日期', name: 'begndate', width: 105, align: 'center', formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },
     { label: '结束日期', name: 'enddate', width: 105, align: 'center', formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },
     { label: '结算时间', name: 'setl_time', width: 105, align: 'center', formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },
     { label: '医疗费总额', name: 'medfee_sumamt', width: 85, align: 'center' },
     { label: '统筹基金', name: 'hifp_pay', width: 85, align: 'center' },
     { label: '公务补助', name: 'cvlserv_pay', width: 85, align: 'center' },
     { label: '企业补助', name: 'hifes_pay', width: 85, align: 'center' },
     { label: '居民大病', name: 'hifmi_pay', width: 85, align: 'center' },
     { label: '职工大额', name: 'hifob_pay', width: 85, align: 'center' },
     { label: '医疗救助', name: 'maf_pay', width: 85, align: 'center' },
     { label: '个人支付', name: 'psn_pay', width: 85, align: 'center' },
     { label: '个人账户', name: 'acct_pay', width: 85, align: 'center' }
                ];
                break;
            case "5":
                captionCon = "费用明细";
                colModel = [
     { label: '结算ID', name: 'setl_id', width: 65, align: 'center' },
     { label: '就诊ID', name: 'mdtrt_id', width: 65 },
     { label: '费用流水号', name: 'feedetl_sn', width: 65, align: 'center' },
     { label: '数量', name: 'cnt', width: 55, align: 'center'},
     { label: '单价', name: 'pric', width: 55, align: 'center' },
     { label: '总额', name: 'det_item_fee_sumamt', width: 60, align: 'center' },
     { label: '全自费金额', name: 'fulamt_ownpay_amt', width: 60, align: 'center' },
     { label: '超限价金额', name: 'overlmt_amt', width: 60, align: 'center' },
     { label: '先行自付金额', name: 'preselfpay_amt', width: 60, align: 'center' },
     { label: '符合政策范围', name: 'inscp_scp_amt', width: 60, align: 'center' },
     { label: '医保目录编码', name: 'hilist_code', width: 80, align: 'center' },
     { label: '医保目录名称', name: 'hilist_name', width: 100, align: 'center' },
     { label: '医疗目录编码', name: 'med_list_codg', width: 100, align: 'center' },
     { label: '开单科室编码', name: 'bilg_dept_codg', width: 70, align: 'center' },
     { label: '开单科室名称', name: 'bilg_dept_name', width: 100, align: 'center' }
                ];
                break;
            case "6":
                captionCon = "人员慢特病用药记录";
                colModel = [
     { label: '费用流水号', name: 'feedetl_sn', width: 105, align: 'center' },
     { label: '数量', name: 'cnt', width: 105, align: 'center' },
     { label: '单价', name: 'pric', width: 105, align: 'center' },
     { label: '费用发生时间', name: 'fee_ocur_time', width: 125, align: 'center' },
      { label: '医保目录编码', name: 'hilist_code', width: 105, align: 'center' },
     { label: '医保目录名称', name: 'hilist_name', width: 105, align: 'center' },
     { label: '医疗目录编码', name: 'med_list_codg', width: 105, align: 'center' },
     { label: '医药机构目录编码', name: 'medins_list_codg', width: 105, align: 'center' },
     { label: '医药机构目录名称', name: 'medins_list_name', width: 105, align: 'center' }

                ];
                break;
            case "7":
                captionCon = "人员累计信息";
                colModel = [
     {
         label: '险种类型', name: 'insutype', width: 105, align: 'center', formatter: function (val) {
             return $.enum.getDescByValue("Enumxzlx", val);
         }
     },
     { label: '年度', name: 'year', width: 105, align: 'center' },
     { label: '累计年月', name: 'cum_ym', width: 105, align: 'center' },
     { label: '累计类别代码', name: 'cum_type_code', width: 125, align: 'center' },
      { label: '累计值', name: 'cum', width: 105, align: 'center' }

                ];
                break;
            case "8":
                captionCon = "人员特殊病备案查询";
                colModel = [
     { label: '门慢门特病种目录代码', name: 'opsp_dise_code', width: 105, align: 'center' },
     { label: '门慢门特病种名称', name: 'opsp_dise_name', width: 405, align: 'center' },
     { label: '开始日期', name: 'begndate', width: 105, align: 'center' },
     { label: '结束日期', name: 'enddate', width: 105, align: 'center' }

                ];
                break;
            case "9":
                captionCon = "人员定点信息查询";
                colModel = [
     {
         label: '险种类型', name: 'insutype', width: 105, align: 'center', formatter: function (val) {
             return $.enum.getDescByValue("Enumxzlx", val);
         }
     },
     { label: '定点排序号', name: 'fix_srt_no', width: 105, align: 'center' },
     { label: '定点医药机构编号', name: 'fixmedins_code', width: 105, align: 'center' },
     { label: '定点医药机构名称', name: 'fixmedins_name', width: 125, align: 'center' },
     { label: '开始日期', name: 'begndate', width: 105, align: 'center' },
     { label: '结束日期', name: 'enddate', width: 125, align: 'center' }
                ];
                break;
            case "10":
                captionCon = "在院信息查询";
                colModel = [
     { label: '就诊ID', name: 'mdtrt_id', width: 105, align: 'center' },
     {
         label: '险种类型', name: 'insutype', width: 105, align: 'center', formatter: function (val) {
             return $.enum.getDescByValue("Enumxzlx", val);
         }
     },
     { label: '开始日期', name: 'begndate', width: 105, align: 'center' },
     {
         label: '医疗类别', name: 'med_type', width: 125, align: 'center', formatter: function (val) {
             return $.enum.getDescByValue("Enumyllb", val);
         }
     },
     { label: '住院/门诊号', name: 'ipt_otp_no', width: 105, align: 'center' },
     { label: '异地标志', name: 'out_flag', width: 125, align: 'center' }
                ];
                break;
            case "11":
                captionCon = "转院信息查询";
                colModel = [
     {
         label: '险种类型', name: 'insutype', width: 105, align: 'center', formatter: function (val) {
             return $.enum.getDescByValue("Enumxzlx", val);
         }
     },
     {
         label: '申报来源', name: 'dcla_souc', width: 105, align: 'center', formatter: function (val) {
             return $.enum.getDescByValue("Enumsbly", val);
         }
     },
     { label: '诊断代码', name: 'diag_code', width: 105, align: 'center' },
     { label: '诊断名称', name: 'diag_name', width: 125, align: 'center' },
     { label: '转往定点医药机构编号', name: 'reflin_medins_no', width: 105, align: 'center' },
     { label: '转往医院名称', name: 'reflin_medins_name', width: 125, align: 'center' },
     {
         label: '异地标志', name: 'out_flag', width: 105, align: 'center', formatter: function (val) {
             return $.enum.getDescByValue("Enumdyxsbz", val);
         }
     },
     { label: '转院日期', name: 'refl_date', width: 125, align: 'center' },
     { label: '开始时间', name: 'begndate', width: 105, align: 'center' },
     { label: '结束时间', name: 'enddate', width: 125, align: 'center' },
     {
         label: '医院同意转院标志', name: 'hosp_agre_refl_flag', width: 125, align: 'center', formatter: function (val) {
             return $.enum.getDescByValue("Enumdyxsbz", val);
         }
     }
                ];
                break;
        }
        $("#gbox_gridList").remove();
        $(".gridPanel").append('<table id="gridList"></table>');
        $('#gridList').jqGrid("clearGridData");
        var $gridList = $("#gridList");

        $gridList.newtouchLocalDataGrid({
            height: $(window).height() - 330,
            autowidth: false,
            unwritten: false,
            width: $("#formPat2").width() - 10,
            caption: captionCon,
            colModel: colModel,
        }, mydata);
    }



    //读卡 调用01,13接口
    function GetReadCardInfo(sbkobj, boolVal) {
        var cardInfo1;
        var cardInfo2;
        var cardInfo3;
        var yibaoCardInfo;
        var patsbkh = null;

        var url = "http://127.0.0.1:33333/api/YiBao/CardecInfo_1161";
        var payoptype = { "mdtrt_cert_type": $('#readCardCardType').val(), "operatorId": '@(opr.rygh)', "operatorName": '@(opr.UserName)', "businessType": "01101", "officeId": "0201", "officeName": "内科" };
        if ($('#readCardCardType').val() === "02") {
            payoptype.mdtrt_cert_no = sbkobj.sbkh;
            url = "http://127.0.0.1:33333/api/YiBao/CardecInfo_1101";
        }
        else if ($('#readCardCardType').val() === "01") {
            url = "http://127.0.0.1:33333/api/YiBao/CardecInfo_1162";
        }
        $.ajax({
            type: "POST",
            url: url,
            dataType: "json",
            data: payoptype,
            async: false,
            success: function (data) {
                yibaoCardInfo = eval('(' + data + ')');
            }
        });
        $.loading(false);
        if (yibaoCardInfo) {

            if (yibaoCardInfo.infcode == "0") {
                if (!yibaoCardInfo || !yibaoCardInfo.output.baseinfo || !yibaoCardInfo.output.insuinfo[0]) {
                    $.modalAlert("读卡失败:" + yibaoCardInfo.err_msg, 'error');
                    return;
                }
                var ybklx = $('#readCardCardType').val();
                cardInfo1 = yibaoCardInfo.output.baseinfo; //医保基本信息
                cardInfo2 = yibaoCardInfo.output.insuinfo[0];//参保信息
                if (ybklx !== "02") {
                    cardInfo3 = yibaoCardInfo.output.cardecinfo;//卡信息
                    cqPatInfo.ecToken = cardInfo3.ecToken;
                    cqPatInfo.sbkh = cardInfo3.cardno;
                }
                cqPatInfo.xm = cardInfo1.psn_name;
                cqPatInfo.sfzh = cardInfo1.certno;
                cqPatInfo.xzqh = cardInfo2.insuplc_admdvs;
                cqPatInfo.cblb = cardInfo2.psn_type;
                cqPatInfo.xzlx = cardInfo2.insutype;
                cqPatInfo.grbh = cardInfo1.psn_no;

                $("#rybh").html(cardInfo1.psn_no);
                $("#zjhm").html(cardInfo1.certno);
                $("#xm").html(cardInfo1.psn_name);
                $("#xb").html(cardInfo1.gend=="1"?"男":"女");
                //$("#mz").html(cardInfo1.naty);
                $("#csny").html(cardInfo1.brdy);
                $("#nl").html(cardInfo1.age+"岁");

            } else {
                $.loading(false);
                $.modalAlert("刷卡失败:" + yibaoCardInfo.err_msg, 'error');
            }
        }
        else {
            $.loading(false);
            $.modalAlert("刷卡获取医保信息失败！失败原因：医保中心无信息返回，请重试！", 'error');
        }



    }
    //手输社保卡号
    function GetPatSbkh() {
        $.modalOpen({
            id: "sbkhInput",
            title: "卡号输入",
            url: "/OutpatientManage/OutpatientReg/OutPatientSbkhInput?t=" + Math.random(),
            width: "300px",
            height: "150px",
            callBack: function (iframeId) {
                top.frames[iframeId].PatSbkhData();
            }
        });
    }
    $('#readCard i').click(function () {
        setTimeoutReadCard();
    });

    //触发读卡
    function setTimeoutReadCard() {
        $.loading(true, '正在读卡，请稍后…');
        setTimeout("readCard();", 50);
    }


</script>
